//
//  NYSignInView.m
//  NiuWaJiaoYu
//
//  Created by MinLison on 2018/1/2.
//  Copyright © 2018年 niuwaketang. All rights reserved.
//

#import "NYSignInView.h"
@interface NYSignInView ()
@property(nonatomic, strong) QMUIGhostButton *iconButton;
@property(nonatomic, strong) TTTAttributedLabel *titleLabel;
@property(nonatomic, strong) TTTAttributedLabel *desLabel;
@property(nonatomic, strong, readwrite) QMUIGhostButton *shareButton;
@end
@implementation NYSignInView
- (void)setupView
{
        [super setupView];
        [self addSubview:self.iconButton];
        [self addSubview:self.titleLabel];
        [self addSubview:self.desLabel];
        [self addSubview:self.shareButton];
        
        [self.iconButton mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self).offset(__WGHeight(28));
                make.centerX.equalTo(self);
                make.height.width.mas_equalTo(__WGHeight(118));
        }];
        [self.titleLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.iconButton.mas_bottom).offset(__WGHeight(21));
                make.centerX.equalTo(self.iconButton);
        }];
        
        [self.desLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.titleLabel.mas_bottom).offset(__WGHeight(19));
                make.centerX.equalTo(self.iconButton);
                make.left.equalTo(self).offset(__WGWidth(62));
                make.right.equalTo(self).offset(-__WGWidth(62));
        }];
        
        [self.shareButton mas_remakeConstraints:^(MASConstraintMaker *make) {
                make.top.equalTo(self.desLabel.mas_bottom).offset(__WGHeight(22));
                make.centerX.equalTo(self.iconButton);
                make.bottom.greaterThanOrEqualTo(self.mas_bottom).offset(-__WGHeight(26));
                make.height.mas_equalTo(__WGHeight(38));
                make.width.mas_equalTo(__WGWidth(170));
        }];
}
- (void)setSignInModel:(NYSignInModel *)signInModel
{
        _signInModel = signInModel;
        self.titleLabel.text = @"打卡成功";
        
        self.desLabel.text = [NSString stringWithFormat:@"我家宝贝在小学课堂平台， 已经连续学习了%@天",NOT_NULL_STRING_DEFAULT_EMPTY(signInModel.num)];
}
- (QMUIGhostButton *)shareButton
{
        if (_shareButton == nil) {
                _shareButton = [[QMUIGhostButton alloc] init];
                _shareButton.cornerRadius = __WGHeight(19);
                _shareButton.ghostColor = UIColorWhite;
                _shareButton.backgroundColor = UIColorHex(0x26A7FF);
                _shareButton.clipsToBounds = YES;
                _shareButton.titleLabel.font = WGSystem16Font;
                [_shareButton setTitle:@"分享" forState:(UIControlStateNormal)];
        }
        return _shareButton;
}
- (QMUIGhostButton *)iconButton
{
        if (_iconButton == nil) {
                _iconButton = [[QMUIGhostButton alloc] init];
                _iconButton.ghostColor = UIColorHex(0xFFDC32);
                _iconButton.backgroundColor = UIColorHex(0xFFDC32);
                [_iconButton setImage:[UIImage da_qia_cheng_gong] forState:(UIControlStateNormal)];
                _iconButton.clipsToBounds = YES;
                
        }
        return _iconButton;
}
- (TTTAttributedLabel *)titleLabel
{
        if (_titleLabel == nil) {
                _titleLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
                _titleLabel.font = WGBoldSystemFont(28);
                _titleLabel.textColor = UIColorBlack;
                _titleLabel.textAlignment = NSTextAlignmentCenter;
        }
        return _titleLabel;
}
- (TTTAttributedLabel *)desLabel
{
        if (_desLabel == nil) {
                _desLabel = [[TTTAttributedLabel alloc] initWithFrame:CGRectZero];
                _desLabel.font = WGSystem13Font;
                _desLabel.numberOfLines = 0;
                _desLabel.textColor = UIColorGray5;
                _desLabel.textAlignment = NSTextAlignmentCenter;
        }
        return _desLabel;
}
@end
